﻿using System.Collections.ObjectModel;
using Moria.Common.Enum;
using Redbrick.Silverlight.Common;

namespace Moria
{
    public class Race
    {
        #region Constructors
        private Race(string trace, int str_adj, int int_adj, int wis_adj, int dex_adj, int con_adj, int chr_adj, int b_age, int m_age, int m_b_ht, int m_m_ht, int m_b_wt, int m_m_wt, int f_b_ht, int f_m_ht, int f_b_wt, int f_m_wt, int b_dis, int srh, int stl, int fos, int bth, int bthb, int bsav, int bhitdie, int infra, int b_exp, int rtclass)
        {
            this.adj = new int[] { 0,0,0,0,0,0 };
            this.trace = trace;
            this.str_adj = str_adj;
            this.int_adj = int_adj;
            this.wis_adj = wis_adj;
            this.dex_adj = dex_adj;
            this.con_adj = con_adj;
            this.chr_adj = chr_adj;
            this.b_age = b_age;
            this.m_age = m_age;
            this.m_b_ht = m_b_ht;
            this.m_m_ht = m_m_ht;
            this.m_b_wt = m_b_wt;
            this.m_m_wt = m_m_wt;
            this.f_b_ht = f_b_ht;
            this.f_m_ht = f_m_ht;
            this.f_b_wt = f_b_wt;
            this.f_m_wt = f_m_wt;
            this.b_dis = b_dis;
            this.srh = srh;
            this.stl = stl;
            this.fos = fos;
            this.bth = bth;
            this.bthb = bthb;
            this.bsav = bsav;
            this.bhitdie = bhitdie;
            this.infra = infra;
            this.b_exp = b_exp;
            this.rtclass = rtclass;
        }
        #endregion
        #region Properties
        ///<summary>
        /// Type of race			
        ///</summary>
        public string trace { get; private set; }
        ///<summary>
        /// adjustments			
        ///</summary>
        public int str_adj { get { return this.adj[Stat.A_STR.Int()]; } private set { this.adj[Stat.A_STR.Int()] = value; } }
        public int int_adj { get { return this.adj[Stat.A_INT.Int()]; } private set { this.adj[Stat.A_INT.Int()] = value; } }
        public int wis_adj { get { return this.adj[Stat.A_WIS.Int()]; } private set { this.adj[Stat.A_WIS.Int()] = value; } }
        public int dex_adj { get { return this.adj[Stat.A_DEX.Int()]; } private set { this.adj[Stat.A_DEX.Int()] = value; } }
        public int con_adj { get { return this.adj[Stat.A_CON.Int()]; } private set { this.adj[Stat.A_CON.Int()] = value; } }
        public int chr_adj { get { return this.adj[Stat.A_CHR.Int()]; } private set { this.adj[Stat.A_CHR.Int()] = value; } }
        public int[] adj { get; private set; }
        ///<summary>
        /// Base age of character		
        ///</summary>
        public int b_age { get; private set; }
        ///<summary>
        /// Maximum age of character	
        ///</summary>
        public int m_age { get; private set; }
        ///<summary>
        /// base height for males		
        ///</summary>
        public int m_b_ht { get; private set; }
        ///<summary>
        /// mod height for males		
        ///</summary>
        public int m_m_ht { get; private set; }
        ///<summary>
        /// base weight for males		
        ///</summary>
        public int m_b_wt { get; private set; }
        ///<summary>
        /// mod weight for males		
        ///</summary>
        public int m_m_wt { get; private set; }
        ///<summary>
        /// base height females		
        ///</summary>
        public int f_b_ht { get; private set; }
        ///<summary>
        /// mod height for females	
        ///</summary>
        public int f_m_ht { get; private set; }
        ///<summary>
        /// base weight for female	
        ///</summary>
        public int f_b_wt { get; private set; }
        ///<summary>
        /// mod weight for females	
        ///</summary>
        public int f_m_wt { get; private set; }
        ///<summary>
        /// base chance to disarm		
        ///</summary>
        public int b_dis { get; private set; }
        ///<summary>
        /// base chance for search	
        ///</summary>
        public int srh { get; private set; }
        ///<summary>
        /// Stealth of character		
        ///</summary>
        public int stl { get; private set; }
        ///<summary>
        /// frequency of auto search	
        ///</summary>
        public int fos { get; private set; }
        ///<summary>
        /// adj base chance to hit	
        ///</summary>
        public int bth { get; private set; }
        ///<summary>
        /// adj base to hit with bows	
        ///</summary>
        public int bthb { get; private set; }
        ///<summary>
        /// Race base for saving throw	
        ///</summary>
        public int bsav { get; private set; }
        ///<summary>
        /// Base hit points for race	
        ///</summary>
        public int bhitdie { get; private set; }
        ///<summary>
        /// See infra-red			
        ///</summary>
        public int infra { get; private set; }
        ///<summary>
        /// Base experience factor	
        ///</summary>
        public int b_exp { get; private set; }
        ///<summary>
        /// Bit field for class types	    
        ///</summary>
        public int rtclass { get; private set; }

        #endregion Properties
        #region Race Table

        public static Race[] Table = 
        {
            new Race("Human",	 0,  0,	 0,  0,	 0,  0,14,  6, 72,  6,180, 25, 66,  4,150, 20,0,  0,  0,  0,  0,  0,  0, 10,  0, 100, 0x3F),
            new Race("Half-Elf", -1,  1,	 0,  1, -1,  1,24, 16, 66,  6,130, 15, 62,  6,100, 10,2,  6,  1, -1, -1,  5,  3,  9,  2, 110, 0x3F),
            new Race("Elf",	-1,  2,	 1,  1, -2,  1,75, 75, 60,  4,100,  6, 54,  4, 80,  6,5,  8,  1, -2, -5, 15,  6,  8,  3, 120, 0x1F),
            new Race("Halfling", -2,  2,	 1,  3,	 1,  1,21, 12, 36,  3, 60,  3, 33,  3, 50,  3,15, 12,  4, -5,-10, 20, 18,  6,  4, 110, 0x0B),
            new Race("Gnome",	-1,  2,	 0,  2,	 1, -2,50, 40, 42,  3, 90,  6, 39,  3, 75,  3,10,  6,  3, -3, -8, 12, 12,  7,  4, 125, 0x0F),
            new Race("Dwarf",	 2, -3,	 1, -2,	 2, -3,35, 15, 48,  3,150, 10, 46,  3,120, 10,2,  7,  -1,  0, 15,  0,  9,  9,  5, 120, 0x05),
            new Race("Half-Orc",	 2, -1,	 0,  0,	 1, -4,11,  4, 66,  1,150,  5, 62,  1,120,  5,-3,  0, -1,  3, 12, -5, -3, 10,  3, 110, 0x0D),
            new Race("Half-Troll",4, -4, -2, -4,	 3, -6,20, 10, 96, 10,255, 50, 84,  8,225, 40,-5, -1, -2,  5, 20,-10, -8, 12,  3, 120, 0x05),
        };

        #endregion Race Table
    }
}
